#include "case.hh"

Case::Case ()
{
  empty_ = true;
  nb_food_ = 0;
  ant_ = 0;
}

Case::~Case ()
{
}

bool
Case::is_empty ()
{
  return empty_;
}

void
Case::add_pB (int i)
{
  ++nb_pB_[i];
}
void
Case::sub_pB (int i)
{
  --nb_pB_[i];
}
int
Case::get_pB (int i)
{
  return nb_pB_[i];
}

void
Case::add_pF (int i)
{
  ++nb_pF_[i];
}
void
Case::sub_pF (int i)
{
  --nb_pF_[i];
}
int
Case::get_pF (int i)
{
  return nb_pF_[i];
}

void
Case::add_pW (int i)
{
  ++nb_pW_[i];
}
void
Case::sub_pW (int i)
{
  --nb_pW_[i];
}
int
Case::get_pW (int i)
{
  return nb_pW_[i];
}

void
Case::add_pQ (int i)
{
  ++nb_pQ_[i];
}
void
Case::sub_pQ (int i)
{
  --nb_pQ_[i];
}
int
Case::get_pQ (int i)
{
  return nb_pQ_[i];
}



void
Case::set_food (int nb)
{
  nb_food_ = nb;
}
void
Case::sub_food ()
{
  --nb_food_;
}
int
Case::get_food ()
{
  return nb_food_;
}


void
Case::set_food_type (std::string name)
{
  if (name == "food")
    type_food_ = FOOD;
  else if (name == "water")
    type_food_ = WATER;
}

e_ant
Case::get_food_type ()
{
  return type_food_;
}

void
Case::set_ant (Ants* ant)
{
  ant_ = ant;
}

Ants&
Case::get_ant ()
{
  return *ant_;
}

bool
Case::is_ant ()
{
  return ant_ != 0;
}

int
Case::get_interest_queen (int team)
{
  std::vector<int>::iterator it;
  int res = 0;
  int i = 0;

  std::cout << "team: " << team;

  res = nb_pQ_[team];
  for (it = nb_pB_.begin (), i = 0; it != nb_pB_.end (); it++, ++i)
  {
    if (i != team)
      res -= nb_pB_[i];
  }
  std::cout << " - interest " << res << std::endl;
  return res < 0 ? 0 : res;
}

int
Case::get_interest_food (int team)
{
  std::vector<int>::iterator it;
  int res = 0;
  int i = 0;

  std::cout << "team: " << team;

  res = nb_pF_[team];
  for (it = nb_pB_.begin (), i = 0; it != nb_pB_.end (); it++, ++i)
  {
    if (i != team)
      res -= nb_pB_[i];
  }
  std::cout << " - interest " << res << std::endl;
  return res < 0 ? 0 : res;
}

int
Case::get_interest_water (int team)
{
  team = team;
  return 0;
}
